
<?php

/*
	//不为纯数字格式


//$pattern = '\/(\d.+)\/';
$pattern = '/(\d .+)/';
if（） 
var_dump($pattern);
*/

/*

		//正则

$password = $_POST['password'];
//$password = '0wert5rtyuio5676';
//$pattern = "/(^[a-zA-Z]{1})(\w.+)/";
//
//$password = '5678905676878989';
$pattern = "/([^0-9])/";

$res = preg_match($pattern,$password);
//var_dump($matches);  //$matches是索引数组

var_dump($res);
if (!$res) {
	exit('错误');
}
	echo '正确';


*/



	//邮箱格式-----不能以数字开头-----"/(^[a-zA-Z]{1})(\w.+)/";
/*
$email= $_POST['email'];
$pattern="/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i";
if(preg_match($pattern,$email)){
    echo '邮箱验证通过！';
} else{
    echo '邮箱格式错误！';
}
*/



	//邮箱格式/^[A-Za-z]{1}
$email= $_POST['email'];
$pattern="/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i";
$res = preg_match($pattern,$email,$matches);
if($res){
	var_dump($matches);
    echo '邮箱验证通过！';
} else{
    echo '邮箱格式错误！';
}


/*
$password = $_POST['password'];
$pattern  = "/(^[a-zA-Z]{1})(\w.+)/";
$res = preg_match($pattern ,$password,$matches);
var_dump($res);
var_dump($matches);
if ($res)  
  {  
  	
      echo '密码正确';  
  }  else{
  	echo '密码正确';
  }

*/
 /* 
  $password = $_POST['password'];
//$passPattern = '/(\d+)/';				//纯数字
$passPattern = "/^(?!\d+$)(?![a-z]+$).+$/i";		//非纯数字
if (preg_match($passPattern,$password,$matches)) {
	var_dump($matches);
	exit('密码不能为纯数字');
}

echo '111';

die;
*/